(function() {
         // 主题切换
         const themeToggle = document.getElementById('theme-toggle');
         // 检查用户偏好
         if (localStorage.getItem('color-theme') === 'dark' ||
             (!localStorage.getItem('color-theme') && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
             document.documentElement.classList.add('dark');
         } else {
             document.documentElement.classList.remove('dark');
         }
         themeToggle.addEventListener('click', function () {
             // 切换暗色模式
             document.documentElement.classList.toggle('dark');
             // 保存用户偏好
             if (document.documentElement.classList.contains('dark')) {
                 localStorage.setItem('color-theme', 'dark');
             } else {
                 localStorage.setItem('color-theme', 'light');
             }
         });
 })();